<?php
namespace slinks\extensions\action\routing;

use slinks\core\Config\Resource\ResourceInterface;

/**
 * A IIRouteCollection represents a set of Route instances.
 *
 * @author navid
 */
interface IRouteCollection {
    
    /**
     * Adds a route.
     *
     * @param string $name  The route name
     * @param Route  $route A Route instance
     *
     * @throws \InvalidArgumentException When route name contains non valid characters
     */
    public function add($name, Route $route);

    /**
     * Returns the array of routes.
     *
     * @return array An array of routes
     */
    public function all();

    /**
     * Gets a route by name.
     *
     * @param  string $name  The route name
     *
     * @return Route  $route A Route instance
     */
    public function get($name);

    /**
     * Adds a route collection to the current set of routes (at the end of the current set).
     *
     * @param IRouteCollection $collection A IRouteCollection instance
     * @param string          $prefix     An optional prefix to add before each pattern of the route collection
     */
    public function addCollection(IRouteCollection $collection, $prefix = '');

    /**
     * Adds a prefix to all routes in the current set.
     *
     * @param string          $prefix     An optional prefix to add before each pattern of the route collection
     */
    public function addPrefix($prefix);

    /**
     * Returns an array of resources loaded to build this collection.
     *
     * @return ResourceInterface[] An array of resources
     */
    public function getResources();

    /**
     * Adds a resource for this collection.
     *
     * @param ResourceInterface $resource A resource instance
     */
    public function addResource(ResourceInterface $resource);
}

?>
